<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>数据导入</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../layui/css/layui.css" media="all">
    <script type="text/javascript" src='../../../jquery_v1.11.3/jquery.min.js'></script>
    <script type="text/javascript" src='../../../layui/layui.all.js'></script>
    <script type="text/javascript" src="../../base/common.js"></script>
    <script src="../../../echarts/echarts.min.js"></script>
</head>
<body>
<table class="layui-table">
    <colgroup>
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>数据源</th>
        <th>状态</th>
        <th>导入</th>
        <th>重置</th>
    </tr>
    </thead>
    <tbody>

    <tr>
        <td>多乐融数据</td>
        <td id = "dlr">未导入</td>
        <td><button class="layui-btn" onclick="dataImport('dlr')">导入</button></td>
        <td><button class="layui-btn" onclick="rest('dlr')">重置</button></td>
    </tr>
    <tr>
        <td>恒易融数据</td>
        <td id = "hyr">未导入</td>
        <td><button class="layui-btn" onclick="dataImport('hyr')" >导入</button></td>
        <td><button class="layui-btn" onclick="rest('hyr')">重置</button></td>
    </tr>
    <tr>
        <td>恒易贷数据</td>
        <td id = "hyd">未导入</td>
        <td><button class="layui-btn" onclick="dataImport('hyd')" >导入</button></td>
        <td><button class="layui-btn" onclick="rest('hyd')">重置</button></td>
    </tr>
    <tr>
        <td>聚合支付数据</td>
        <td id = "jhzf">未导入</td>
        <td><button class="layui-btn" onclick="dataImport('jhzf')" >导入</button></td>
        <td><button class="layui-btn" onclick="rest('jhzf')">重置</button></td>
    </tr>
    <tr>
        <td>小恒钱包数据</td>
        <td id = "xhqb">未导入</td>
        <td><button class="layui-btn" onclick="dataImport('xhqb')" >导入</button></td>
        <td><button class="layui-btn" onclick="rest('xhqb')">重置</button></td>
    </tr>
    <tr>
        <td>个贷数据</td>
        <td id = "gd">未导入</td>
        <td><button class="layui-btn" onclick="dataImport('gd')" >导入</button></td>
        <td><button class="layui-btn" onclick="rest('gd')">重置</button></td>
    </tr>
    <tr>
        <td>小贷数据</td>
        <td id = "xd">未导入</td>
        <td><button class="layui-btn" onclick="dataImport('xd')" >导入</button></td>
        <td><button class="layui-btn" onclick="rest('xd')">重置</button></td>
    </tr>
    <tr>
        <td>信托数据</td>
        <td id = "xt">未导入</td>
        <td><button class="layui-btn" onclick="dataImport('xt')" >导入</button></td>
        <td><button class="layui-btn" onclick="rest('xt')">重置</button></td>
    </tr>
    <tr>
        <td>恒慧融借款数据</td>
        <td id = "hhrjk">未导入</td>
        <td><button class="layui-btn" onclick="dataImport('hhrjk')" >导入</button></td>
        <td><button class="layui-btn" onclick="rest('hhrjk')">重置</button></td>
    </tr>
    </tbody>
</table>

<script>
    $(function () {
        getStatus();
    })
    function rest(a) {
        $.ajax({
            type: 'get',
            url: dataServerPre + "/api/data/yzt/v1/service/data/"+a+"/rest",
            dataType: 'json',
            headers: {"token": getCookie("token")}
        })
        $("#"+a).html("未导入");
    }
    function dataImport( a) {
        $.ajax({
            type: 'get',
            url: dataServerPre + "/api/data/yzt/v1/service/data/"+a+"/old",
            dataType: 'json',
            headers: {"token": getCookie("token")},
            success: function (result) {
                if(result == "ok"){
                    $("#"+a).html("已完成");
                }

            }
        })
        $("#"+a).html("已开始");
    }
    function getStatus() {
        $.ajax({
            type: 'get',
            url: dataServerPre + "/api/data/yzt/v1/service/data/old/status",
            dataType: 'json',
            headers: {"token": getCookie("token")},
            success: function (result) {
                $("#dlr").html(result.dlr);
                $("#hyr").html(result.hyr);
                $("#hyd").html(result.hyd);
                $("#jhzf").html(result.jhzf);
                $("#xhqb").html(result.xhqb);
            }
        });
    }
</script>

</body>
</html>